<extend name="Layout:layout_content" />
<block name="body_main">
    <ul class="xsui-breadcrumb">
        <li><a href="{:U('product_goods_list')}"><i  class="fa fa-home fa-fw"></i>商品管理</a></li>
        <li class="current"><a href="{:U('product_goods_edit','id='.$data['id'])}" class="xsui-lnk-edit-dialog" data-id="{$data.id}" title="编辑主商品 {$data.title}">{$data.title}</a></li>
    </ul>
    <div class="grid-parent xsui-page-header">
        <div class="grid-60 mobile-grid-100 grid-parent">
            <a href="{:U('product_specification_goods_edit','pid='.$data['id'].'&cid='.$data['category_id'])}" class="xsui-btn ui-state-default xsui-lnk-add-dialog"><i class="fa fa-plus"></i>新增规格商品</a>
            <a href="#" class="xsui-btn ui-state-default xsui-lnk-refresh"><i class="fa fa-refresh"></i>刷新</a>
        </div>
        <div class="grid-40 mobile-grid-100 grid-parent xsui-text-right"></div>
    </div>
    <div id="grid-container">
        <table class="xsui-table xsui-table-striped xsui-table-hover xsui-table-bordered">
            <thead>
                <tr>
                    <th>商品标题</th>
                    <th>规格代码</th>
                    <th>价格</th>
                    <th>图片</th>
                    <th>库存数量</th>
                    <th>排序</th>
                    <th>状态</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
            <foreach name="list" item="vo">
                <tr data-key="{$vo.id}">
                    <td class="xsui-nowrap" title="{$vo.title}"><a href="{:U('product_specification_goods_edit','id='.$vo['id'].'&pid='.$vo['pid'].'&cid='.$vo['category_id'])}" class="xsui-lnk-edit-dialog" data-id="{$vo.id}" title="编辑 {$vo.title}">{:sofn_msubstr($vo['title'],0,30)}</a></td>
                    <td>{$vo.specification_code}</td>
                    <td>{$vo.price}</td>
                    <td style="padding:0">&nbsp;
                <if condition="$vo['picture_url']">
                    <a href="{$vo['picture_url']}" target="_blank"><img src="{$vo['picture_url']}" alt="" style="width:24px; height:24px; margin-top:2px;" /></a>
                </if>
                </td>
                <td>{$vo.stock}</td>
                <td class="sort"><input type="text" value="{$vo.sort}" size="3" data-value="{$vo.sort}" data-url="{:U('change_sort','id='.$vo['id'].'&sort=varsort')}" title="更改后,鼠标点击页面任意位置即可自动生效" /></td>
                <td class="status"><a href="{:U('change_status','id='.$vo['id'].'&status=varstatus')}" data-value="{$vo.status}" title="点击隐藏" class="xsui-success"><i class="fa fa-check fa-fw"></i></a></td>
                <td class="xsui-nowrap">{$vo.create_time}</td>
                <td>
                    <ul class="xsui-operate-group">
                        <li><a href="#" class="xsui-btn ui-state-default xsui-icon-right">操作<i class="fa fa-caret-square-o-down"></i></a>
                            <ul>
                                <li><a href="{:U('product_specification_goods_edit','id='.$vo['id'].'&pid='.$vo['pid'].'&cid='.$vo['category_id'])}" class="xsui-lnk-edit-dialog" data-id="{$vo.id}" title="编辑 {$vo.title}"><i class="fa fa-edit fa-fw"></i>编辑</a></li>
                                <li><a href="{:U('ProductInvoicing/invoicing_list','product_id='.$vo['id'])}" data-id="{$vo.id}" title="出入库管理 {$vo.title}"><i class="fa fa-table fa-fw"></i>出入库管理</a></li>
                                <li><a href="{:U('ProductAlbum/image_list','product_id='.$vo['id'])}" data-id="{$vo.id}" title="图集管理 {$vo.title}"><i class="fa fa-picture-o fa-fw"></i>图集管理</a></li>
                                <li><a href="{:U('ProductInvoicing/invoicing_out_edit','product_id='.$vo['id'])}" class="xsui-lnk-edit-dialog" data-id="{$vo.id}" title="新增出库 {$vo.title}"><i class="fa fa-edit fa-fw"></i>新增出库</a></li>
                                <li><a href="{:U('ProductInvoicingIn/invoicing_in_edit','product_id='.$vo['id'])}" class="xsui-lnk-edit-dialog" data-id="{$vo.id}" title="新增入库 {$vo.title}"><i class="fa fa-edit fa-fw"></i>新增入库</a></li>
                                <li><a href="{:U('product_goods_delete','id='.$vo['id'])}" class="xsui-lnk-remove" data-id="{$vo.id}" title="删除 {$vo.title}"><i class="fa fa-remove fa-fw"></i>删除</a></li>
                            </ul>
                        </li>
                    </ul>
                </td>
                </tr>
            </foreach>
            </tbody>
        </table>
        <div class="xsui-pagination">{$page}</div>
    </div>
</block>
<block name="body_after">    
    <script type="text/javascript">
        $(function () {
            // 状态显示处理 2016-1-18 SoChishun Added.
            // 如：<td class="status"><a href="AddonU('change_status','id='.$vo['id'].'&status=varstatus')" title="点击隐藏" data-value="$vo.status" class="xsui-success"><i class="fa fa-check fa-fw"></i></a></td>
            $('td.status a').togglelink();
            // 动态更改排序 2015-10-24 SoChishun Added.
            $('td.sort input').blur(function () {
                var $input = $(this);
                change_sort($input);
            })
            //ajax_combobox({selector: 'select[name="category_id"]', def_option: '请选择类别'});
        })
    </script>
</block>